home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / Kubuntu 8.10 / kubuntu-8.10-desktop-i386.iso / casper / filesystem.squashfs / usr / share / doc / mdetect / README < prev    next >
Text File  |  2000-11-25  |  3KB  |  87 lines

  1.  
  2.             The Mouse Detective :-)
  3.  
  4. This is an incomplete program for mouse detection. The idea is to
  5. use it in some kind of dialog that says: try to move your mouse and
  6. click on the OK button. If this doesn't work, enter return [the
  7. keyboard focus is on cancel].
  8.  
  9. Use it like this:
  10.  
  11.     $ ./mdetect -v
  12.     Found the following devices:
  13.        /dev/ttyS1
  14.        /dev/ttyS0
  15.        /dev/psaux
  16.    [start moving mouse]
  17.     microsoft:     105 102
  18.     logitech: LM  -27 27
  19.     microsoft: L   6  -43
  20.     logitech: LM  93 191
  21.     microsoft:     7  -7
  22.     Detected microsoft mouse on /dev/ttyS0
  23.  
  24. You can see it switching between logitech and microsoft mode until it settles
  25. on microsoft mode. Invoking it without the -v switch disables all output
  26. except for the `Detected ... mouse' line.
  27.  
  28. Currently, the following mice are reported:
  29.  
  30.     psaux        PS/2
  31.     mousesystems    MouseSystems compatible
  32.     microsoft    Old Microsoft protocol
  33.     logitech    Some (old) logitech mice
  34.     mouseman    MouseMan (microsoft with 3/4 packet extension)
  35.  
  36. Here's a framework that I think might work
  37.  
  38.  1.    Start the mouse detection program
  39.  2.    Start X server, display dialog
  40.  3.    User starts moving the mouse
  41.  4.    Detection program tries to understand what the mouse
  42.     tries to say (this is stage1). It should arrive at a
  43.     decision within 1 sec.
  44.  5a.    Detection program has decided on a driver. Enters stage2,
  45.     where it writes the mouse packets it received into a fifo
  46.     (but now, in a mouse-type independent packet format). This is
  47.     basically what gpm -R does.
  48.  
  49.     Pointer starts to move on the screen.
  50.  
  51.  5b.    Detection Program wasn't able to detect mouse type. It doesn't
  52.     do anything. Pointer doesn't move, user has to select mouse
  53.     manually.
  54.  
  55. NB: How does XF86Config set the mouse type? I assume there's an X
  56. extension?  If so, in step 5, we can also tell the X server what mouse
  57. to use (if we know what to use), and exit. This is a lot better than
  58. the fifo approach.
  59.  
  60.  
  61.  
  62. Mode of Operation
  63.  
  64. What the program does is open all available devices for reading.
  65. Whenever it gets a byte, it lets all drivers (currently psaux, microsoft,
  66. logitech) have a look at it. If the driver can make sense of the
  67. packet, fine. If any driver is able to successfully decode 20 mouse
  68. packets in a row, it is considered _the_ driver.
  69.  
  70. Serial mice are a bit special, since they use different line settings
  71. etc. So there's a serial 'meta' driver that sets the line characteristics
  72. to those of each driver in turn.
  73.  
  74. Currently, I'm able to detect either ps2 or an M$-compatible mouse
  75. fairly reliably. I haven't tested the logitech code. If you don't jiggle
  76. the mouse too hard, detection is faster; otherwise, it will start with
  77. a few false guesses before settling on the right one. Good packets are
  78. those that can be decoded, have reasonable dx/dy values and no mouse
  79. button pressed. (this might be improved by looking at the second
  80. derivative, so to speak: changes in dx/dy values sent by the mouse
  81. shouldn't be too large).
  82.  
  83. The question is whether this is really worth the trouble. Maybe we will
  84. have as high a success rate if we use ps2 when able to open the device;
  85. and ttyS0 with the M$ protocol otherwise.
  86.  
  87.